/* eslint-disable import/no-extraneous-dependencies */
const proxy = require('http-proxy-middleware');

const target = 'http://11.51.204.130';
module.exports = function (app) {
  app.use(
    proxy('/api', {
      target,
      secure: false,
      changeOrigin: true,
      headers: {
        Host: '',
        Connection: 'keep-alive',
      },
      pathRewrite: {
        '^/api': '/api',
      },
    })
  );

  app.use(
    proxy('/geojson', {
      target,
      secure: false,
      changeOrigin: true,
      headers: {
        Host: '',
        Connection: 'keep-alive',
      },
      pathRewrite: {
        '^/geojson': '/geojson',
      },
    })
  );

  app.use(
    proxy('/oss-imonet', {
      target,
      secure: false,
      changeOrigin: true,
      headers: {
        Host: '',
        Connection: 'keep-alive',
      },
      pathRewrite: {
        '^/oss-imonet': '/oss-imonet',
      },
    })
  );
};
